/*
 * @Author: your name
 * @Date: 2021-04-23 23:32:50
 * @LastEditTime: 2021-04-24 07:47:06
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \offer20k\项目代码\fantasticit\src\pages\Knowledgenotes\index.tsx
 */
import React, { useEffect, useState } from "react"
import store from '@/store/index'
import useStore from '@/context/useStore'
import { observer } from 'mobx-react-lite'
import { useHistory } from "umi"
import { IKnowledgeList } from '@/util/knowledge'// ts
import { timeAgo } from '@/util/getTime'// 获取时间间隔
import Knowledgenotes from '@/components/Knowledgenotes'
const Index: React.FC = () => {
    const history = useHistory();
    let { Knowledge } = useStore()
    useEffect(() => {
        Knowledge.getKnowledge()
    }, [])
  
    let KnowledgeList = JSON.parse(JSON.stringify(Knowledge.KnowledgeList))
    let goDetailPage = (item: IKnowledgeList) => {
        history.push({
            pathname: 'knowledgenotes/' + item.id
        })
    }
    // 视图组件
    return (<Knowledgenotes KnowledgeList={KnowledgeList} timeAgo={timeAgo} goDetailPage={goDetailPage}></Knowledgenotes>

    )
}
export default observer(Index)
// function item(item: any): string | number | boolean | {} | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactNodeArray | React.ReactPortal | null | undefined {
//     throw new Error("Function not implemented.")
// }
